﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TinyERP.Framework.Controls
{
    public partial class CustomResultList : UserControl
    {
        public event PageChangedHandler OnPageChanged;
        public event CustomDataGridViewSortEventHandler ColumnSortChanged;
        public CustomResultList()
        {
            InitializeComponent();
            this.paging.OnPageChanged += new PageChangedHandler(PagingOnPageChanged);
            this.dataGridView.ColumnSortChanged += new CustomDataGridViewSortEventHandler(DataGridViewColumnSortChanged);
        }

        void DataGridViewColumnSortChanged(object sender, SortColumnChangedEvent e)
        {
            if (ColumnSortChanged != null)
            {
                this.ColumnSortChanged(sender, e);
            }
        }

        void PagingOnPageChanged(object sender, PagingArg arg)
        {
            if (OnPageChanged != null)
            {
                OnPageChanged(sender, arg);
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [Editor(typeof(CustomGridColumnEditor),
            typeof(System.Drawing.Design.UITypeEditor)), MergableProperty(false)]
        public DataGridViewColumnCollection DisplayColumns
        {
            get
            {
                return this.dataGridView.Columns;
            }
        }
    }
}
